package com.heima.sjms.策略模式;

import java.util.Scanner;

public class Context {
    private Strategy strategy;

    public void setStrategy(Strategy strategy) {
        this.strategy = strategy;
    }

    public void executeStrategy() {
        strategy.execute();
    }
}

class Main {
    public static void main(String[] args) {
        Context context = new Context();

        // 使用策略A
        System.out.println("请输入您的选择：");
        Scanner sc = new Scanner(System.in);
        String week = sc.next();
        switch (week){
            case "1":
                context.setStrategy(new ConcreteStrategyA());
                context.executeStrategy();
                break;
            case "2":
                // 使用策略B
                context.setStrategy(new ConcreteStrategyB());
                context.executeStrategy();
            case "3":
                // 使用策略C
                context.setStrategy(new ConcreteStrategyC());
                context.executeStrategy();
                break;
        }






    }
}